﻿using System.Linq;
using System.Web.Mvc;
using Omu.AwesomeDemo.Core.Model;
using Omu.AwesomeDemo.Core.Repository;
using Omu.AwesomeDemo.Infra.Dto;

namespace Omu.AwesomeDemo.WebUI.Controllers
{
    public class AjaxRadioListDemoController : BaseController
    {
        private readonly IRepo<Hobby> hobbyRepo;

        public AjaxRadioListDemoController(IRepo<Hobby> hobbyRepo)
        {
            this.hobbyRepo = hobbyRepo;
        }

        public ActionResult Index()
        {
            return View(new AjaxRadioListDemoInput{ Hobby = hobbyRepo.GetAll().First().Id});
        }

        [HttpPost]
        public ActionResult Index(AjaxRadioListDemoInput input)
        {
            return View(input);
        }
    }
}